import logging
import redis


class Config(object):
    # 配置sqlalchemy
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/eight08'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 配置redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 配置秘钥
    SECRET_KEY = 'EmTV76jNrtoBs4Rt/qH3r5wsRbu205G5H19VOBbWh04='

    # 配置Session
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 3600


class DevelopmentConfig(Config):
    # 开发环境下
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    # 生产环境下
    DEBUG = False
    LOG_LEVEL = logging.WARNING



